package org.arrendar.kakeibo.controller;

import org.apache.wicket.Application;
import org.apache.wicket.protocol.http.HttpSessionStore;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
import org.apache.wicket.session.ISessionStore;
import org.arrendar.kakeibo.config.taskqueue.Amend;
import org.arrendar.kakeibo.config.taskqueue.TaskQueue;
import org.arrendar.kakeibo.view.InputForm;
import org.arrendar.kakeibo.view.KakeiboList;
import org.arrendar.kakeibo.view.MainPage;
import org.arrendar.kakeibo.view.MonthlyTotal;
import org.arrendar.kakeibo.view.TopPage;

public class ArrendarApplication extends WebApplication {
	
	public ArrendarApplication() {
	}
	
	protected void init() {
		super.init();
		getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
		getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
		getPageSettings().setAutomaticMultiWindowSupport(false);
		mount(new MixedParamUrlCodingStrategy("/main", MainPage.class,new String[]{"User","Logout"}));
		mount(new MixedParamUrlCodingStrategy("/list", KakeiboList.class,new String[]{"User","Logout"}));
		mount(new MixedParamUrlCodingStrategy("/input", InputForm.class,new String[]{"User","Logout"}));
		mount(new MixedParamUrlCodingStrategy("/total", MonthlyTotal.class,new String[]{"User","Logout"}));
		mountBookmarkablePage("/queue", TaskQueue.class);
		mount(new MixedParamUrlCodingStrategy("/amend",Amend.class,new String[]{}));
	}
	
	@Override
	public String getConfigurationType() {
		return Application.DEPLOYMENT;
	}

	@Override
	protected ISessionStore newSessionStore() {
		return new HttpSessionStore(this);
	}
	
	public Class<TopPage> getHomePage() {
		return TopPage.class;
	}
}
